// SpecDefSelectionFactoryVersionOne.cpp: implementation of the SpecDefSelectionFactoryVersionOne class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SpecDefSelectionFactoryVersionOne.h"
#include "specDefApp.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

namespace Specification
{
	SpecDefSelectionFactoryVersionOne::SpecDefSelectionFactoryVersionOne()
	{
		
	}
	
	SpecDefSelectionFactoryVersionOne::~SpecDefSelectionFactoryVersionOne()
	{
		
	}
	
	typeSpecDefSelection SpecDefSelectionFactoryVersionOne::newSelection(const StdString& strSpecID)
	{
		StdString source = SpecDefApp::Instance()->GetSpecDefPath();
		StdString strManagerName = SpecDefApp::Instance()->GetSpecManName();
		UEConnectionPtr connPtr;
		typeSpecDefSelection recordSetPtr;
		try
		{
			connPtr = UEConnectionManager::Instance().GetConnection(source);
			StdString strsql;
			strsql = _T("select * from [") + strManagerName + _T("] where SpecKey = '") +strSpecID+ _T("' ");
			recordSetPtr = connPtr->ExecuteSelectSQL(strsql);
		
		}
		catch (UEException *e) 
		{
			e->ReportError();
			e->Delete();
		}
		return recordSetPtr;
	}
}
